package com.culturalCenter.dataCenter.controller.web;

import com.culturalCenter.dataCenter.Utils.ApiResult;
import com.culturalCenter.dataCenter.Utils.ResultCode;
import com.culturalCenter.dataCenter.customEntity.responseParam.volunteer.VolunteerActivityResponse;
import com.culturalCenter.dataCenter.customEntity.responseParam.volunteer.VolunteerResponse;
import com.culturalCenter.dataCenter.customEntity.responseParam.volunteer.VolunteerSignInResponse;
import com.culturalCenter.dataCenter.globalconfig.Interface.ApiVersion;
import com.culturalCenter.dataCenter.globalconfig.Interface.CustomVersion;
import com.culturalCenter.dataCenter.service.volunteer.CdcVolunteerActivityService;
import com.culturalCenter.dataCenter.service.volunteer.CdcVolunteerService;
import com.culturalCenter.dataCenter.service.volunteer.CdcVolunteerSignuprecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

import static com.culturalCenter.dataCenter.Utils.ApiResult.instance;

/**
 * 志愿者
 *
 * @author 方治森
 * @since 2021/9/18
 */
@RestController
@RequestMapping("/{version}/volunteer")
@Api(tags = "志愿者模块")
@ApiVersion(CustomVersion.VERSION_1)
@Slf4j
public class VolunteerController {

    @Resource
    private CdcVolunteerService cdcVolunteerService;
    @Resource
    private CdcVolunteerActivityService cdcVolunteerActivityService;
    @Resource
    private CdcVolunteerSignuprecordService cdcVolunteerSignuprecordService;

    /**
     * @Description 用户统计
     * @Param []
     * @Return com.culturalCenter.dataCenter.Utils.ApiResult
     */
    @ApiOperation(value = "用户统计", notes = "用户统计")
    @GetMapping("/userStatistics")
    public ApiResult<VolunteerResponse> getUserStatistics() {
        VolunteerResponse volunteerResponse = cdcVolunteerService.userStatistics();
        return instance(ResultCode.SUCCESS, volunteerResponse);
    }

    /**
     * @Description 活动统计
     * @Param []
     * @Return com.culturalCenter.dataCenter.Utils.ApiResult
     */
    @ApiOperation(value = "活动统计", notes = "活动统计")
    @GetMapping("/activityStatistics")
    public ApiResult<VolunteerActivityResponse> getActivityStatistics() {
        VolunteerActivityResponse activityResponse = cdcVolunteerActivityService.activityStatistics();
        return instance(ResultCode.SUCCESS, activityResponse);
    }

    /**
     * @Description 签到统计
     * @Param []
     * @Return com.culturalCenter.dataCenter.Utils.ApiResult
     */
    @ApiOperation(value = "签到统计", notes = "签到统计")
    @GetMapping("/signInStatistics")
    public ApiResult<VolunteerSignInResponse> getSignInStatistics() {
        VolunteerSignInResponse signInResponse = cdcVolunteerSignuprecordService.signInStatistics();
        return instance(ResultCode.SUCCESS, signInResponse);
    }

}
